import { createBrowserRouter } from "react-router-dom";
import Layout from "@/Layout";
import Home from "@/pages/Home.tsx";
import Detail from "@/pages/Detail";
import List from '@/pages/List.tsx';
import Settings from '@/pages/Settings.tsx';

const router = [
    {
        path: "/",
        element: <Layout />,
        children: [
            {
                path: "/",
                index: true,
                element: <Home />,
                // loader: async () => {
                //     const response = await fetch('http://localhost:5173/api/news?pageNum=1&pageSize=10');
                //     const data = await response.json();
                //     return data;
                // }
            }, {
                path: "settings",
                element: <Settings />
            }
        ]
    }, {
        path: "/detail/:id",
        element: <Detail />,
    }, {
        path: "list",
        element: <List />
    }
]


export default createBrowserRouter(router);